#include "RBSphere.h"

RBSphere::RBSphere()
{
	m_radius = 0;
	m_rbType = SPHERE;
}
	
void RBSphere::Draw()
{

}

void RBSphere::Update()
{	
	static const D3DXVECTOR3 GRAVITY(0.0f, -3.0f, 0.0f);
// linear movements
	// calculate acceleration from force and inverse mass

	// calculate velocity from acceleration

	// calculate new position from velocity

	m_acceleration = m_force * m_inverseMass;
	if (m_inverseMass > 0)
	{
		m_acceleration += GRAVITY;
	}
	//m_acceleration *= 0.9f;
	CalculatePositionE(m_position, m_oldVelocity, m_velocity, m_acceleration);

// rotational movements
	m_rotAcceleration = m_torque;	//inverse moment of intertia and total torque
	// can sub moment of interia to a const value scaled
	// to the size of the rigidbody
	m_rotation += m_rotVelocity * TheTimer::Instance()->GetDt();
	m_torque = 0.0f;
	m_force = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
}

const float RBSphere::GetRadius() const
{
	return m_radius;
}

void RBSphere::SetRadius(float radius)
{
	m_radius = radius;
}